namespace Collaboris.Saf.Actions.Moss.Tests.Generated
{
    using System.Collections.Generic;

    using Engine.Report;

    using Entities;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Publishing;

    using Saf.Tests;

    using SharePoint.Wss.Files;

    [TestClass]
    public class UpdatePublishingPageFieldsTest
    {
        #region Public Methods

        [TestMethod]
        public void updatePublishingPageFields_Test()
        {
            var updatePublishingPageFields = new TestAssistant<UpdatePublishingPageFields, PublishingPageFieldsInfo>(
                TestEnvironment.PublishingSite, "updatePublishingPageFieldsTestWeb", "BLANKINTERNET#0");

            using (updatePublishingPageFields)
            {
                SPFile file = SPFileHelper.GetFile(updatePublishingPageFields.TestWeb, updatePublishingPageFields.FirstEntity.PageRelativeUrl);
                SPFileHelper.CheckOutFile(file);
                MacroReport doReport = updatePublishingPageFields.DoMacro();

                foreach (KeyValuePair<string, object> o in updatePublishingPageFields.FirstEntity.Fields)
                {
                    Assert.IsTrue(file.Item[o.Key].ToString() == o.Value.ToString(), o.Key + " not matched!");
                }
                
                SPFileHelper.DiscardCheckOutOfFile(file);
            }
        }

        #endregion
    }
}